package com.bootcamp.mall.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;

/**
 * @program: mall
 * @description: code and data
 * @author: Keyu Li
 * @create: 2021-11-09 09:13
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    // 0 表示登录成功，10000 表示各种异常
    Integer code;
    // 如果操作异常，返回错误信息
    String message;
    // 存储vo对象，展示给浏览器界面
    Object data;

    public static Result ok(Object data){
        return new Result(0,null,data);
    }

    public static Result ok(){
        return new Result(0,null,null);
    }
    public static Result error(String message){
        return new Result(10000,message,null);
    }
}
